package generalobjects;

import com.google.common.base.Objects;

public class Animal {
    private String name;

    private int sex;

    public Animal(String name, int sex) {
        this.name = name;
        this.sex = sex;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getSex() {
        return sex;
    }

    public void setSex(int sex) {
        this.sex = sex;
    }

    @Override public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Animal animal = (Animal)o;
        return sex == animal.sex && Objects.equal(name, animal.name);
    }

    @Override public int hashCode() {
        return Objects.hashCode(name, sex);
    }
}